﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.Organization.API.Application.Command.ClientClientCommand;
using S.Organization.API.Application.Command.FieldSettingCommand;

namespace S.Organization.API.Controllers
{
    /// <summary>
    /// 客户
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ClientController : ControllerBase
    {
        private readonly IMediator _mediator;

        public ClientController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 客户添加
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> AddClient(AddClientCommand request, CancellationToken cancellationToken)
        {
            return Ok(await _mediator.Send(request));
        }


        /// <summary>
        /// 客户添加111
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AddClient111()
        {
            return Ok();
        }


        /// <summary>
        /// 客户删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> DelClient([FromQuery]DelClientCommand request, CancellationToken cancellationToken)
        {
            return Ok(await _mediator.Send(request));
        }
    }
}
